package com.ly.ocw.service.weixin;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ly.ocw.exception.ServerException;
import com.ly.ocw.utils.HttpUtil;

/**
 * 微信门店服务
 * 
 * @author Peter
 *
 */
@Component
public class WeixinPoiService {
	
	private static Logger logger = LoggerFactory.getLogger(WeixinPoiService.class);
	@Autowired
	private WeixinConf weixinConf;

	private static ObjectMapper mapper = new ObjectMapper();
	{
		mapper.setSerializationInclusion(Include.NON_NULL);
	}

	@Autowired
	private WeixinAccessTokenService weixinAccessTokenService;
	
	@Autowired
	private WeixinCardTestwhitelistService weixinCardTestwhitelistService;

	public String getPoiList() throws ClientProtocolException, IOException, ServerException {
		String body = "{\"begin\":0,\"limit\":20}";
		String url = "https://api.weixin.qq.com/cgi-bin/poi/getpoilist?access_token=" + weixinAccessTokenService.getAccessToken();
		String respStr = HttpUtil.httpPost(url, body);
		return respStr;
	}



}
